{extend name="default/template/base_index" /}

{block name="area_header"}
<link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/select2.min.css" />
<link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/cosmo-skin.css" />
<style>
/**自定义 tooltip 样式 start*/
.tooltip-box{
    position: absolute;
    display: block;
    line-height: 1.6;
    background-color: #fff;
    border: 1px solid #666;
    font-size: 12px;
    border-radius: 5px;
    overflow: auto;
    top:0px;left:0px;
    z-index: 9;
}
.img-show{ position:relative; }
/**自定义 tooltip 样式 end*/
th{ vertical-align: middle !important; }
.select2-selection{ border:none !important;height:34px !important; }
.select2-selection .select2-selection__rendered{ height:35px !important; }
.select2-dropdown{ border-color: #ddd !important; }
</style>
{/block}

{block name="area_body"}
{include file="default/Widget/topbar" /}
<div class="admin-main container-fluid">
    {include file="default/Widget/left" /}
    <div class="admin-main-content">
        {include file="default/Widget/breadcrumb" /}

        <div class="table well">
            <div class="h4"><b>技工认证信息</b> - <a title="通过将更新用户信息,驳回将删除申请" data-toggle="tooltip" data-placement="right">审核</a></div>
            <br >
            <div class="filter-controls">
                <form class="form-inline" method="post" action="{:url('Member/workerVerify')}">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-user"></i>用户</div>
                            <div class="form-control" style="padding: 0px;">
                                <select id="user_select2" name="uid">
                            {if condition="$uid gt 0"><option value="{$uid}" selected="selected"} [id:{$uid}] {$nickname}</option>{/if}
                            </select>
                            </div>
                        </div>
                        <button class="btn btn-primary" type="submit"> <i class="fa fa-search"></i>查询</button>
                    </div>
                </form>
            </div>
            <br >
            <table class="table table-bordered table-striped table-condensed table-hover table-condensed">
                <thead>
                <tr>
                    <th rowspan="2">ID</th>
                    <th rowspan="2">用户昵称</th>
                    <th rowspan="2">申请时间</th>
                    <th colspan="3">申请信息</th>
                    <th rowspan="2">操作</th>
                </tr>
                <tr>
                    <th>真实姓名</th>
                    <th>身份证号</th>
                    <th>身份证</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="v"}
                <tr>
                    <td>
                        {$v.id}</td>
                    <td>
                        <a href="{:url('Member/view',array('id'=>$v['uid']))}" title="点击查看该用户详情" data-toggle="tooltip"><img src="{:app\\src\\base\\helper\\ConfigHelper::getAvatarUrl($v['uid'],60)}" style="width: 40px;height:40px;border-radius: 50%" />{$v.nickname|default='--'}</a></td>
                    <td>
                        {:date("Y-m-d H:i:s",$v['create_time'])}</td>
                    <td>
                        {$v.realname}</td>
                    <td>
                        {$v.id_number}</td>
                    <td>
                        {volist name="$v.id_certs" id="vo"}
                          <label class="img-show">{:imgTooltip($vo,120)}</label>
                        {/volist}</td>
                    <td>
                        <a href="{:url('Member/workerPass',array('id'=>$v['id']))}" class="btn btn-primary btn-sm ajax-get"><i class="fa fa-check"></i>通过</a>
                        <a href="{:url('Member/workerDeny',array('id'=>$v['id']))}" class="btn btn-sm btn-danger ajax-get" ><i class="fa fa-times"></i>驳回</a></td>
                  </tr>
                {/volist}
                </tbody>
            </table>
            <div>{$show}</div>
        </div>

    </div>
    <!-- END admin-main-content -->
</div>
<!-- END admin-main-->
{/block}

{block name="area_footer"}
<script src="__CDN__/select2/4.0.0/js/select2.min.js"></script>
<script src="__CDN__/select2/4.0.0/js/i18n/zh-CN.js"></script>
<script type="text/javascript">
    $(function(){
        //图片自定义 tooltip start
        var $tip,$img;
        $('.img-show').hover(function(e){
            var $this = $(this);
            $img  = $this.children('img');
            $tip  = $this.children('.tooltip-box');
            if($tip.length){}else{
                html = '<img  class="tooltip-box" src="'+$img.data('src')+'" />';
                $tip = $(html);
                $this.append($tip);
            }
            if ($this.offset().left + $tip.width() > document.body.clientWidth) {
                 $tip.css({left:-($tip.width() + $this.offset().left - document.body.clientWidth + 10),display:'block'});
            }else{
                $tip.css({display:'block'});
            }
        },function(){
            $(this).find('.tooltip-box').css('display','none');
        });
        //图片自定义 tooltip start
        //选择用户 ajax start
        $("#user_select2").select2({
            width:300,
            placeholder: "输入用户id或昵称查询",
            language: "zh-CN",
            ajax: {
                url: "{:url('Member/select')}",
                dataType: 'json',
                delay: 250,
                data: function (params) {
                    var queryParameters = {
                        q: params.term
                    }
                    return queryParameters;
                },
                processResults: function (data, params) {
                    if(!data.data){
                        data.data = new Array();
                        data.data['nodata']="无相关数据";
                    }
                    return {
                        results: data.data
                    };
                },
                cache: true
            },
            minimumInputLength: 0,
            templateSelection: function (repo) {
                return repo.nickname ? '[id:'+repo.id+'] '+repo.nickname : repo.text;
            },
            templateResult: function (repo) {
                if (repo.loading) return repo.text;
                if(repo.nodata)   return repo.nodata;
                // var markup = '<div>'+repo.nickname+'</div>';
                var markup = '<div><img src="'+repo.head+'" style="width:30px;height:30px;"/>[id:'+repo.id+'] '+repo.nickname+'</div>';
                return $(markup);
            },
        });
        //选择用户 ajax end
    });
</script>
{/block}